package com.example.medicine.View;

import com.example.medicine.Bean.zhengzhuang;
import com.example.medicine.Mapper.zyzzMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Slf4j
@Controller
public class zyzzView {
    @Autowired
    private zyzzMapper zyzzMapper;
    /**
     * 展示中医症状列表
     * @return
     */
    @RequiresPermissions("中医证候库")
    @RequestMapping("/zyzz")
    public String zyzzShow(){
        log.info("中医证候列表页面");
        return "pages/zyzz/list";}
    @RequiresPermissions("中医证候库")
    @RequestMapping("/zyzz/create")
    public String xyjbCreateShow(){
        log.info("中医证候创建页面");
        return "pages/zyzz/create";
    }
    /**
     * zyjb编辑展示页面
     */
    @RequiresPermissions("中医证候库")
    @GetMapping("/zyzz/edit/{id}")
    public String getTeamById(@PathVariable int id, Model model){
        log.info("中医证候编辑页面");
        zhengzhuang zhengzhuang=zyzzMapper.getById(id);
        zhengzhuang.setId(id);
        model.addAttribute("zhengzhuang", zhengzhuang);
        return "pages/zyzz/edit";
    }
}
